using System.Configuration;

namespace WineCellar.Web.Common
{
    public class MembershipManagerSection :ConfigurationSection
    {
        public class Fields 
        {
			public const string AdministrationProviderName= "AdministrationProviderName";
			public const string RequiresApproval= "RequiresApproval";
			public const string Email= "Email";
			public const string Links= "Links";

        }
        public MembershipManagerSection()
        {

        }

        [ConfigurationProperty(Fields.AdministrationProviderName)]
        public string AdministrationProviderName
        {
            get { return (string)this[Fields.AdministrationProviderName]; }
            set { this[Fields.AdministrationProviderName] = value; }
        }
        [ConfigurationProperty(Fields.RequiresApproval)]
        public bool RequiresApproval
        {
            get { return (bool)this[Fields.RequiresApproval]; }
            set { this[Fields.RequiresApproval] = value; }
        }

        [ConfigurationProperty("Email")]
        public EmailElement Email
        {
            get { return (EmailElement)this[Fields.Email]; }
            set { this[Fields.Email]=value; }
        }
        [ConfigurationProperty("Links")]
        public LinksElement Links 
        {
            get { return (LinksElement) this[Fields.Links];}
            set { this[Fields.Links] = value; }

        }
        public static MembershipManagerSection GetConfig()
        {
            return (MembershipManagerSection) ConfigurationManager.GetSection("MembershipManager");
        }
    }
    public class LinksElement : ConfigurationElement
    {
        public class Fields
        {

			public const string LoginController = "LoginController";
        	public const string LoginAction = "LoginAction";			
			public const string AccessDeniedAction = "AccessDeniedAction";
        }

        [ConfigurationProperty(Fields.LoginController)]
        public string LoginController
        {
            get { return (string)this[Fields.LoginController]; }
            set { this[Fields.LoginController] = value; }
        }

		[ConfigurationProperty(Fields.LoginAction)]
		public string LoginAction
		{
			get { return (string)this[Fields.LoginAction]; }
			set { this[Fields.LoginAction] = value; }
		}        

		[ConfigurationProperty(Fields.AccessDeniedAction)]
		public string AccessDeniedAction
		{
			get { return (string)this[Fields.AccessDeniedAction]; }
			set { this[Fields.AccessDeniedAction] = value; }
		}
    }
    public class EmailElement : ConfigurationElement
    {
        public class Fields
        {
			public const string From= "From";
			public const string Signature= "Signature";
			public const string System= "System";
			public const string ReplyEmail= "ReplyEmail";
        }

        public EmailElement()
        {

        }

        [ConfigurationProperty(Fields.From)]
        public string From
        {
            get { return (string)this[Fields.From]; }
            set { this[Fields.From] = value; }
        }

        [ConfigurationProperty(Fields.Signature)]
        public string Signature
        {
            get { return (string)this[Fields.Signature]; }
            set { this[Fields.Signature] = value; }
        }
        [ConfigurationProperty(Fields.System)]
        public string System
        {
            get { return (string)this[Fields.System]; }
            set { this[Fields.System] = value; }
        }

        [ConfigurationProperty(Fields.ReplyEmail)]
        public string ReplyEmail
        {
            get { return (string)this[Fields.ReplyEmail]; }
            set { this[Fields.ReplyEmail] = value; }
        }
    }
}
